import Request from "./request/index.ts";
import { BASE_URL } from "./constance.ts";

//继承自axiosconfig
import type { MyAXiosRequestConfig } from "./types.ts";

// 创建一个 实例 传入参数
const config1: MyAXiosRequestConfig = {
  baseURL: BASE_URL,
  timeout: 5000,
  interceptor: {
    reqSuccessFn: config => {
      console.log("实例的请求拦截");
      return config;
    },

    resSuccessFn: res => {
      console.log("实例的响应拦截");

      return res;
    },
  },
};
//根据 swage api 创建 医院管理接口
// 创建一个 实例 传入参数
const config2: MyAXiosRequestConfig = {
  baseURL: `${BASE_URL}/api/hosp/hospital`,
  timeout: 2000,
};

const requestInstance = new Request(config2);

const HospitalManage = new Request(config2);

export { HospitalManage, requestInstance };
